package br.dcc.ufmg.persistence;

import java.sql.ResultSet;

import br.dcc.ufmg.domain.Package;

public class PackagesDAO extends ArtifactDAO<Package> {
	
	public String buildSqlArtifactsMeasures(String project, Package package_,
			String metric) {
		StringBuilder sqlBuilder = new StringBuilder(
				"SELECT metric_id, value FROM measure WHERE source_id = '"
						+ project + "' AND metric_id = '" + metric + "' ");
		sqlBuilder.append(" AND name = '").append(package_.getName())
				.append("' and source is null")
				.append(" and package = '")
				.append(package_.getName())
				.append("';");
		return sqlBuilder.toString();
	}

	@Override
	protected String getStringType() {
		// TODO Auto-generated method stub
		return "packageFragment";
	}

	@Override
	protected Package createArtifactFromResultSet(ResultSet rs)
			throws Exception {
		// TODO Auto-generated method stub
		return Package.createPackage(rs);
	}
	
	
}
